import { defineComponent } from "vue";
import { getValueFromPath } from "/@/utils/getData";

export default defineComponent({
  name: "PubObjColumn",
  props: {
    data: {
      type: Array,
      default: () => [],
      required: true
    },
    columnKey: {
      type: String,
      required: true
    },
    height: {
      type: Number,
      default: 40
    }
  },
  setup(props) {
    return () => (
      <div class="contract-list-container">
        {props.data.map((item, index) => (
          <div
            key={index}
            style={{
              padding: "6px",
              height: props.height + "px"
            }}
            class={[
              "contract-list",
              index === props.data.length - 1 ? "no-border" : ""
            ]
              .flat()
              .join(" ")}>
            {getValueFromPath(item, props.columnKey)}
          </div>
        ))}
      </div>
    );
  }
});
